package converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

@FacesConverter("stringToStatusConverter")
public class StringToStatusConverter implements Converter {

	@Override
	public Object getAsObject(FacesContext context, UIComponent component, String value) {
		return (value.equals("Yes") == true) ? new Boolean(true) : new Boolean(false);
	}

	@Override
	public String getAsString(FacesContext context, UIComponent component, Object value) {
		return (Boolean.parseBoolean(String.valueOf(value)) == true) ? "Yes" : "No";
	}
	
}